//
//  CategoryCollectionViewCell.m
//  商品分类列表信息处理
//
//  Created by 我演示 on 2019/10/30.
//  Copyright © 2019 ALLSall. All rights reserved.
//

#import "CategoryCollectionViewCell.h"

@interface CategoryCollectionViewCell ()

/**名称*/
@property(nonatomic,weak) UILabel *nameLabel ;

/**图片*/
@property(nonatomic,weak) UIImageView *iconImage     ;


@end


@implementation CategoryCollectionViewCell


-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        // 添加imageView
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.image = [UIImage imageNamed:@"goodsShow_good"];
        [self.contentView addSubview:imageView];
        self.iconImage = imageView ;
         
        
        //2: 添加label
        UILabel *label = [[UILabel alloc]init];
        label.text = @"haha";
        label.textColor = [UIColor colorWithHexString:@"#333333"];
        label.backgroundColor = [UIColor whiteColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:label];
        self.nameLabel = label;
        

        
    }
    return self;
}

-(void)setModel:(ABSCategoryThirdModel *)model {
    _model = model;
    self.nameLabel.text = model.categoryName;
    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:model.iconUrl] placeholderImage:[UIImage imageNamed:@"goodsShow_good"]];
//    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:model.iconUrl] placeholderImage:<#(nullable UIImage *)#>]
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.iconImage.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 30);
    self.nameLabel.frame = CGRectMake(0, self.frame.size.height - 30, self.frame.size.width, 30);
    
}

@end
